var d = [];
putMyVar("c", "3");
showLoading("开始下载");
var task = function(obj) {
    downloadFile(obj.url, obj.path);
};
be([{
        func: task,
        param: {
            url: "https://gitee.com/qiusunshine233/hikerView/raw/master/module/aes2.js",
            path: "hiker://files/cache/t1.txt"
        },
        id: "task1"
    },
    {
        func: task,
        param: {
            url: "https://gitee.com/qiusunshine233/hikerView/raw/master/module/aes2.js",
            path: "hiker://files/cache/t2.txt"
        },
        id: "task2"
    },
    {
        func: task,
        param: {
            url: "https://gitee.com/qiusunshine233/hikerView/raw/master/module/aes2.js",
            path: "hiker://files/cache/t3.txt"
        },
        id: "task3"
    }
], {
    func: function(obj, id, error) {
        log("task:" + id);
        log("error:" + error);
        //log(obj);
        let count = parseInt(getMyVar("c")) - 1;
        putMyVar("c", count + "");
        log(count);
        if (count > 0) {
            showLoading("下载中，剩余任务：" + count)
        } else {
            hideLoading();
        }
    },
    param: {
        hi: "ccc",
    }
});
setResult(d);